package com.jl.jlapp.mvp.activity;

import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.widget.DrawerLayout;
import android.support.v7.app.ActionBarDrawerToggle;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.EditText;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.PopupWindow;
import android.widget.PopupWindow.OnDismissListener;
import android.widget.RadioButton;
import android.widget.RelativeLayout;
import android.widget.TextView;

import butterknife.BindView;
import butterknife.ButterKnife;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.jl.jlapp.R;
import com.jl.jlapp.adapter.BrandOrderByRecyclerAdapter;
import com.jl.jlapp.adapter.SideslipBrandAdapter;
import com.jl.jlapp.adapter.SideslipClassifityAdapter;
import com.jl.jlapp.eneity.ClassificationModel;
import com.jl.jlapp.eneity.GoodsBrand;
import com.jl.jlapp.mvp.fragment.GoodsListFragment;
import com.jl.jlapp.mvp.fragment.NotFoundGoodsListFragment;
import com.jl.jlapp.nets.CommonObserver;
import com.jl.jlapp.nets.Net;
import com.jl.jlapp.nets.Transformer;
import com.jl.jlapp.utils.CustomGridLayoutManager;


import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

public class SearchGoodsListActivity extends FragmentActivity implements OnClickListener, BrandOrderByRecyclerAdapter.OnItemClickListener {
    public static int index = 0;
    TextView brandBtnText;
    ImageView brandBtnUpordownImg;
    List<Map<String, Object>> brandMsgList = new ArrayList();
    Map<String, Object> brandMsgMap;
    public String brandName = "all";
    TextView brandSearchOkBtn;
    LinearLayout brandSearchPopuBtn;
    TextView brandSearchResetBtn;
    List<String> brands = new ArrayList();
    List<String> brandsThree = new ArrayList();
    boolean brandsVisibleOrGone = false;
    List<Map<String, Object>> chechedBrandMsgList = new ArrayList();
    View checkedtianchuView;
    public Integer classificationId = Integer.valueOf(0);
    List<ClassificationModel.ResultDataBean> classificationModels = new ArrayList();
    boolean classificationVisibleOrGone = false;
    ImageView closeBtnImg;
    public DrawerLayout drawerLayout;
    private ActionBarDrawerToggle drawerbar;
    FragmentManager fragmentManager;
    Fragment goodsListFragment;
    @BindView(R.id.goods_list_top_search_text)
    TextView goodsListTopSearchText;
    TextView goodsSearchRailingBottom;
    boolean isCheckOnlyLookHasGoods = true;
    public String isHasGoods = "true";
    @BindView(R.id.iv_back_left)
    ImageView ivBackLeft;
    private RecyclerView mRecyclerView;
    public String mSearchWorld = "";
    private RelativeLayout main_right_drawer_layout;
    public double maxPrice = 0.0D;
    EditText maxPriceText;
    public double minPrice = 0.0D;
    EditText minPriceText;
    Fragment notFoundGoodsListFragment;
    TextView onlyLookHasGoodsBtn;
    TextView popupShadow;
    public PopupWindow popupwindow;
    RadioButton priceBtn;
    public String priceSort = "";
    BrandOrderByRecyclerAdapter recyclerAdapter;
    RadioButton saleNumBtn;
    TextView shaixuanBtn;
    FrameLayout shopListFragment;
    List<String> sideSlipCeckedBrand;
    Map<String, Object> sideSlipCeckedClassifity;
    List<String> sideSlipClickBrand;
    Map<String, Object> sideSlipClickClassifity;
    SideslipBrandAdapter sideslipBrandAdapter;
    TextView sideslipBrandAllBtn;
    private RecyclerView sideslipBrandContent;
    SideslipClassifityAdapter sideslipClassifityAdapter;
    TextView sideslipClassifyAllBtn;
    private RecyclerView sideslipClassifyContent;
    RelativeLayout sideslipClassifyContentRelative;
    LinearLayout sideslipOkBtn;
    LinearLayout sideslipResetBtn;
    public Integer sortType = Integer.valueOf(1);
    RadioButton synthesizedBtn;
    FragmentTransaction transaction;
    List<ClassificationModel.ResultDataBean.TwoClassificationsBean> twoClassificationModels = new ArrayList();
    List<ClassificationModel.ResultDataBean.TwoClassificationsBean> twoClassificationModelsTwo = new ArrayList();

    public void addDataToPopupwindow() {
        if (!this.popupwindow.isShowing()) {
            GridLayoutManager localGridLayoutManager = new GridLayoutManager(this, 4);
            this.mRecyclerView.setLayoutManager(localGridLayoutManager);
            if (this.recyclerAdapter == null) {
                this.recyclerAdapter = new BrandOrderByRecyclerAdapter(this, this.brands);
                this.mRecyclerView.setAdapter(this.recyclerAdapter);
                this.recyclerAdapter.setOnItemClickListener(this);
            }
            this.recyclerAdapter.setCheckedBrandMsgList(this.chechedBrandMsgList);
            this.recyclerAdapter.notifyDataSetChanged();
            return;
        }
        this.popupwindow.dismiss();
    }

    public void getBrands() {
        Net.get().getBrands().compose(Transformer.<GoodsBrand>switchSchedulers())
                .subscribe(new CommonObserver<GoodsBrand>() {
                    @Override
                    protected void onError(String errorMsg) {

                    }

                    @Override
                    protected void onSuccess(GoodsBrand goodsBrand) {
                        if (goodsBrand.getCode() == 200) {
                            brands = goodsBrand.getResultData();
                        }
                    }
                });
    }

    public void getClassificationMsg() {
        Net.get().getClassificationMsg()
                .compose(Transformer.<ClassificationModel>switchSchedulers())
                .subscribe(new CommonObserver<ClassificationModel>() {
                    @Override
                    protected void onError(String errorMsg) {

                    }

                    @Override
                    protected void onSuccess(ClassificationModel classificationModel) {
                        if (classificationModel.getCode() == 200) {
                            classificationModels = classificationModel.getResultData();
                            getTwoClassification(classificationModels);
                        }
                    }
                });
    }

    public void getTwoClassification(List<ClassificationModel.ResultDataBean> paramList) {

        for (ClassificationModel.ResultDataBean resultData : paramList) {
            for (ClassificationModel.ResultDataBean.TwoClassificationsBean classificationsBean : resultData.getTwoClassifications()) {
                    classificationsBean.setOneClassificationsName(resultData.getName());
                    twoClassificationModels.add(classificationsBean);
                    twoClassificationModelsTwo.add(classificationsBean);
            }
        }
    }

    public void init() {
        this.goodsSearchRailingBottom = ((TextView) findViewById(R.id.goods_search_railing_bottom));
        this.brandSearchPopuBtn = ((LinearLayout) findViewById(R.id.brand_search_popu_btn));
        this.brandBtnText = ((TextView) findViewById(R.id.brand_btn_text));
        this.brandBtnUpordownImg = ((ImageView) findViewById(R.id.brand_btn_upordown_img));
        this.shopListFragment = ((FrameLayout) findViewById(R.id.shop_list_fragment));
        this.synthesizedBtn = ((RadioButton) findViewById(R.id.shop_list_synthesized_text));
        this.saleNumBtn = ((RadioButton) findViewById(R.id.shop_list_sale_num_text));
        this.priceBtn = ((RadioButton) findViewById(R.id.shop_list_price_text));
        this.shaixuanBtn = ((TextView) findViewById(R.id.tv_shaixuan));
        this.onlyLookHasGoodsBtn = ((TextView) findViewById(R.id.only_look_has_goods_btn));
        this.sideslipBrandContent = ((RecyclerView) findViewById(R.id.sideslip_brand_content));
        this.sideslipClassifyContent = ((RecyclerView) findViewById(R.id.sideslip_classify_content));
        this.sideslipOkBtn = ((LinearLayout) findViewById(R.id.sideslip_ok_btn));
        this.sideslipResetBtn = ((LinearLayout) findViewById(R.id.sideslip_reset_btn));
        this.minPriceText = ((EditText) findViewById(R.id.sideslip_min_price));
        this.minPriceText.setInputType(3);
        this.minPriceText.setInputType(2);
        this.maxPriceText = ((EditText) findViewById(R.id.sideslip_max_price));
        this.maxPriceText.setInputType(3);
        this.maxPriceText.setInputType(2);
        this.sideslipClassifyAllBtn = ((TextView) findViewById(R.id.sideslip_classify_all_btn));
        this.sideslipBrandAllBtn = ((TextView) findViewById(R.id.sideslip_brand_all_btn));
        this.sideslipClassifyContentRelative = ((RelativeLayout) findViewById(R.id.relativeLayout_contect));
        this.closeBtnImg = ((ImageView) findViewById(R.id.close_btn_img));
        this.drawerLayout = ((DrawerLayout) findViewById(R.id.goods_search_drawer_layout));
    }

    public void onClick(View paramView) {
        Object localObject;
        int i;
        switch (paramView.getId()) {
            case R.id.brand_search_popu_btn:
                showOrDismissPopup();
                break;
            case R.id.brand_search_ok_btn:
                this.popupwindow.dismiss();
                this.chechedBrandMsgList.clear();
                if (this.brandMsgList.size() > 0) {
                    Iterator<Map<String, Object>> iterator = brandMsgList.iterator();
                    while (iterator.hasNext()) {
                        Map<String, Object> next = iterator.next();
                        this.chechedBrandMsgList.add(next);
                    }
                }
                if (this.chechedBrandMsgList.size() > 0) {
                    this.brandName = "";
                    i = 0;
                    while (i < this.chechedBrandMsgList.size()) {
                        this.brandName += ((Map) this.chechedBrandMsgList.get(i)).get("brandName");
                        if (i < this.chechedBrandMsgList.size() - 1) {
                            this.brandName += ",";
                        }
                        i += 1;
                    }
                }
                this.brandName = "all";
                replaceFragment();
                break;
            case R.id.brand_search_reset_btn:
                this.chechedBrandMsgList.clear();
                this.brandMsgList.clear();
                this.recyclerAdapter.setCheckedBrandMsgList(this.chechedBrandMsgList);
                this.recyclerAdapter.notifyDataSetChanged();
                break;
            case R.id.popup_shadow:
                this.popupwindow.dismiss();
                break;
            case R.id.tv_shaixuan:
                if (this.drawerbar == null) {
                    this.drawerbar = new ActionBarDrawerToggle(this, this.drawerLayout, null, 2131689636, 2131689548) {
                        public void onDrawerClosed(View paramAnonymousView) {
                            super.onDrawerClosed(paramAnonymousView);
                        }

                        public void onDrawerOpened(View paramAnonymousView) {
                            super.onDrawerOpened(paramAnonymousView);
                        }
                    };
                    this.drawerLayout.setDrawerListener(this.drawerbar);
                }
                if (this.drawerLayout.isDrawerOpen(this.main_right_drawer_layout)) {
                    this.drawerLayout.closeDrawer(this.main_right_drawer_layout);
                } else {
                    if (this.sideSlipCeckedBrand.size() == 0) {
                        this.sideSlipClickBrand.clear();
                    }
                    if ("".equals(this.sideSlipCeckedClassifity.get("classifityName"))) {
                        this.sideSlipClickClassifity.put("classifityName", "");
                        this.sideSlipClickClassifity.put("classifityId", Integer.valueOf(0));
                    }
                    this.sideslipBrandAdapter.setChechedName(this.sideSlipCeckedBrand);
                    this.sideslipBrandAdapter.notifyDataSetChanged();
                    this.sideslipClassifityAdapter.setCheckedClassifity(this.sideSlipCeckedClassifity);
                    this.sideslipClassifityAdapter.notifyDataSetChanged();
                    Drawable drawableUp = getResources().getDrawable(R.drawable.up);
                    this.sideslipBrandAllBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, drawableUp, null);
                    this.sideslipBrandContent.setVisibility(View.VISIBLE);
                    this.brandsVisibleOrGone = false;
                    setBeandAdapter();
                    Drawable drawable = getResources().getDrawable(R.drawable.up);
                    this.sideslipClassifyAllBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
                    this.sideslipClassifyContent.setVisibility(View.VISIBLE);
                    this.classificationVisibleOrGone = false;
                    setClassifityAdapter();
                    this.drawerLayout.openDrawer(this.main_right_drawer_layout);
                }
                break;
            case R.id.only_look_has_goods_btn:
                if (this.isCheckOnlyLookHasGoods) {
                    this.onlyLookHasGoodsBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, null, null);
                    this.onlyLookHasGoodsBtn.setBackgroundResource(R.drawable.goods_check_button_m);
                    this.onlyLookHasGoodsBtn.setTextColor(getResources().getColor(R.color.trans_333333));
                    this.isCheckOnlyLookHasGoods = false;
                    return;
                }
                Drawable drawableOk = getResources().getDrawable(R.drawable.checkmark_m);
                this.onlyLookHasGoodsBtn.setCompoundDrawablesWithIntrinsicBounds(drawableOk, null, null, null);
                this.onlyLookHasGoodsBtn.setCompoundDrawablePadding(-50);
                this.onlyLookHasGoodsBtn.setPadding(20, 0, 0, 0);
                this.onlyLookHasGoodsBtn.setBackgroundResource(R.drawable.goods_check_button_m_checked);
                this.onlyLookHasGoodsBtn.setTextColor(getResources().getColor(R.color.checkGreenColor));
                this.isCheckOnlyLookHasGoods = true;
                break;
            case R.id.sideslip_ok_btn:
                if (this.drawerLayout.isDrawerOpen(this.main_right_drawer_layout)) {
                    this.drawerLayout.closeDrawer(this.main_right_drawer_layout);
                } else {
                    this.sideSlipCeckedBrand.clear();
                    if (this.sideSlipClickBrand.size() <= 0) {
                        return;
                    }
                    Iterator<String> iterator = this.sideSlipClickBrand.iterator();
                    while (iterator.hasNext()) {
                        String next = iterator.next();
                        this.sideSlipCeckedBrand.add(next);
                    }
                    this.drawerLayout.openDrawer(this.main_right_drawer_layout);
                }
                if (this.sideSlipCeckedBrand.size() > 0) {
                    this.brandName = "";
                    i = 0;
                    while (i < this.sideSlipCeckedBrand.size()) {
                        this.brandName += (String) this.sideSlipCeckedBrand.get(i);
                        if (i < this.sideSlipCeckedBrand.size() - 1) {
                            this.brandName += ",";
                        }
                        i += 1;
                    }
                }
                this.brandName = "all";
                if (this.sideSlipClickClassifity.get("classifityName") != null) {
                    if ((!"".equals(this.sideSlipClickClassifity.get("classifityName"))) && (((Integer) this.sideSlipClickClassifity.get("classifityId")).intValue() != 0)) {
                        this.sideSlipCeckedClassifity.put("classifityName", this.sideSlipClickClassifity.get("classifityName"));
                        this.sideSlipCeckedClassifity.put("classifityId", (Integer) this.sideSlipClickClassifity.get("classifityId"));
                    }
                    Log.d("aaaaaaaa", "classifityName:" + this.sideSlipCeckedClassifity.get("classifityName") + " classifityId:" + this.sideSlipCeckedClassifity.get("classifityId"));
                    this.classificationId = ((Integer) this.sideSlipCeckedClassifity.get("classifityId"));
                    this.isHasGoods = (this.isCheckOnlyLookHasGoods + "");
                    if (!"".equals(this.minPriceText.getText().toString().trim())) {
                    }
                    this.minPrice = 0.0D;
                    if (!"".equals(this.maxPriceText.getText().toString().trim())) {
                    }
                }
                for (this.maxPrice = 0.0D; ; this.maxPrice = Double.parseDouble(this.maxPriceText.getText().toString().trim())) {
                    if ((this.minPrice > 0.0D) && (this.maxPrice > 0.0D) && (this.maxPrice < this.minPrice)) {
                        double d = this.maxPrice;
                        this.maxPrice = this.minPrice;
                        this.minPrice = d;
                    }
                    replaceFragment();
                    this.classificationId = Integer.valueOf(0);
                    this.minPrice = Double.parseDouble(this.minPriceText.getText().toString().trim());
                }
            case R.id.sideslip_reset_btn:
                this.sideSlipCeckedBrand.clear();
                this.sideSlipCeckedClassifity.clear();
                this.sideSlipClickBrand.clear();
                this.sideSlipClickClassifity.clear();
                this.sideslipBrandAdapter.notifyDataSetChanged();
                this.sideslipClassifityAdapter.notifyDataSetChanged();
                Drawable drawable = getResources().getDrawable(R.drawable.checkmark_m);
                this.onlyLookHasGoodsBtn.setCompoundDrawablesWithIntrinsicBounds(drawable, null, null, null);
                this.onlyLookHasGoodsBtn.setCompoundDrawablePadding(-50);
                this.onlyLookHasGoodsBtn.setPadding(20, 0, 0, 0);
                this.onlyLookHasGoodsBtn.setBackgroundResource(R.drawable.goods_check_button_m_checked);
                this.onlyLookHasGoodsBtn.setTextColor(getResources().getColor(R.color.checkGreenColor));
                this.isCheckOnlyLookHasGoods = true;
                this.minPriceText.setText("");
                this.maxPriceText.setText("");
                break;
            case R.id.sideslip_brand_all_btn:
                if (!this.brandsVisibleOrGone) {
                    Drawable drawableDown = getResources().getDrawable(R.drawable.down);
                    this.sideslipBrandAllBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, drawableDown, null);
                    this.brandsVisibleOrGone = true;
                    setBeandAdapter();
                    return;
                }
                Drawable drawableUp = getResources().getDrawable(R.drawable.up);
                this.sideslipBrandAllBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, drawableUp, null);
                this.brandsVisibleOrGone = false;
                setBeandAdapter();
                break;
            case R.id.sideslip_classify_all_btn:
                if (!this.classificationVisibleOrGone) {
                    Drawable drawableDown = getResources().getDrawable(R.drawable.down);
                    this.sideslipClassifyAllBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, drawableDown, null);
                    this.classificationVisibleOrGone = true;
                    setClassifityAdapter();
                    return;
                }
                Drawable drawableUp1 = getResources().getDrawable(R.drawable.up);
                this.sideslipClassifyAllBtn.setCompoundDrawablesWithIntrinsicBounds(null, null, drawableUp1, null);
                this.classificationVisibleOrGone = false;
                setClassifityAdapter();
                break;
            case R.id.close_btn_img:
                this.drawerLayout.closeDrawer(this.main_right_drawer_layout);
                break;
            case R.id.goods_list_top_search_text:
                Intent intent = new Intent(this, HomeSearchActivity.class);
                intent.putExtra("oldSearchWorld", this.mSearchWorld);
                startActivity(intent);
                break;
            case R.id.shop_list_synthesized_text:
                this.sortType = Integer.valueOf(1);
                this.priceSort = "";
                replaceFragment();
                break;
            case R.id.shop_list_sale_num_text:
                this.sortType = Integer.valueOf(2);
                this.priceSort = "";
                replaceFragment();
                break;
            case R.id.shop_list_price_text:
                if ("".equals(this.priceSort)) {
                    this.priceSort = "asc";
                } else {
                    this.sortType = Integer.valueOf(3);
                    replaceFragment();
                    if ("asc".equals(this.priceSort)) {
                        this.priceSort = "desc";
                    } else {
                        this.priceSort = "asc";
                    }
                }
                break;
        }
    }

    protected void onCreate(Bundle paramBundle) {
        super.onCreate(paramBundle);
        setContentView(R.layout.activity_search_goods_list);
        ButterKnife.bind(this);
        this.fragmentManager = getSupportFragmentManager();
        Intent intent = getIntent();
        this.mSearchWorld = intent.getStringExtra("searchMsg");
        this.sortType = Integer.valueOf(intent.getIntExtra("sortType", 1));
        this.classificationId = Integer.valueOf(intent.getIntExtra("classificationId", 0));
        init();
        setDateToControl();
        setPopupWindow();
        setListener();
        getBrands();
        replaceFragment();
        getClassificationMsg();
        this.popupwindow.setOnDismissListener(new OnDismissListener() {
            public void onDismiss() {
                SearchGoodsListActivity.this.brandBtnText.setTextColor(SearchGoodsListActivity.this.getResources().getColor(R.color.basic_wheelview_color));
                SearchGoodsListActivity.this.brandBtnUpordownImg.setImageDrawable(SearchGoodsListActivity.this.getResources().getDrawable(R.drawable.icon_triangle_down));
            }
        });
    }

    public void onItemClick(int paramInt1, int paramInt2, String paramString) {
        this.brandMsgMap = new HashMap();
        if (paramInt2 == 0) {
            this.brandMsgList.size();
            paramInt2 = 0;
            if (paramInt2 < this.brandMsgList.size()) {
                if (((Integer) ((Map) this.brandMsgList.get(paramInt2)).get("itemPosition")).intValue() != paramInt1) {

                }
                this.brandMsgList.remove(paramInt2);
            }
        } else {
            paramInt2 += 1;
        }
        this.brandMsgMap.put("itemPosition", Integer.valueOf(paramInt1));
        this.brandMsgMap.put("brandName", paramString);
        this.brandMsgList.add(this.brandMsgMap);
    }

    public void replaceFragment() {
        Log.d("aaaaaaActivity", "replaceFragment");
        this.transaction = this.fragmentManager.beginTransaction();
        this.goodsListFragment = new GoodsListFragment();
        this.transaction.replace(R.id.shop_list_fragment, this.goodsListFragment);
        this.transaction.commit();
    }

    public void replaceNoDataFrag() {
        this.transaction = this.fragmentManager.beginTransaction();
        if (this.notFoundGoodsListFragment == null) {
            this.notFoundGoodsListFragment = new NotFoundGoodsListFragment();
        }
        this.transaction.add(R.id.shop_list_fragment, this.notFoundGoodsListFragment);
        this.transaction.commit();
    }

    public void setBeandAdapter() {
        CustomGridLayoutManager localCustomGridLayoutManager = new CustomGridLayoutManager(this, 3, false);
        this.sideslipBrandContent.setLayoutManager(localCustomGridLayoutManager);
        if (this.brandsVisibleOrGone) {
        }
        for (this.sideslipBrandAdapter = new SideslipBrandAdapter(R.layout.shop_list_brand_search_item, this.brands); ; this.sideslipBrandAdapter = new SideslipBrandAdapter(R.layout.shop_list_brand_search_item, this.brandsThree)) {
            this.sideslipBrandAdapter.setChechedName(this.sideSlipClickBrand);
            this.sideslipBrandContent.setAdapter(this.sideslipBrandAdapter);
            this.sideslipBrandAdapter.setOnItemClickListener(new SideslipBrandAdapter.OnItemClickListener() {
                public void onItemClick(BaseQuickAdapter paramAnonymousBaseQuickAdapter, View paramAnonymousView, int paramAnonymousInt) {
                    String str = (String) ((TextView) paramAnonymousView.findViewById(R.id.brand_name)).getText();
                    int i = SearchGoodsListActivity.this.sideSlipClickBrand.size();
                    paramAnonymousInt = 0;
                    for (; ; ) {
                        if (paramAnonymousInt < SearchGoodsListActivity.this.sideSlipClickBrand.size()) {
                            if (((String) SearchGoodsListActivity.this.sideSlipClickBrand.get(paramAnonymousInt)).equals(paramAnonymousBaseQuickAdapter)) {
                                SearchGoodsListActivity.this.sideSlipClickBrand.remove(paramAnonymousInt);
                            }
                        } else {
                            if (i == SearchGoodsListActivity.this.sideSlipClickBrand.size()) {
                                SearchGoodsListActivity.this.sideSlipClickBrand.add(str);
                            }
                            SearchGoodsListActivity.this.sideslipBrandAdapter.setChechedName(SearchGoodsListActivity.this.sideSlipClickBrand);
                            SearchGoodsListActivity.this.sideslipBrandAdapter.notifyDataSetChanged();
                            return;
                        }
                        paramAnonymousInt += 1;
                    }
                }
            });
            return;
        }
    }

    public void setClassifityAdapter() {
        CustomGridLayoutManager localCustomGridLayoutManager = new CustomGridLayoutManager(this, 2, false);
        this.sideslipClassifyContent.setLayoutManager(localCustomGridLayoutManager);
        if (this.classificationVisibleOrGone) {
        }
        for (this.sideslipClassifityAdapter = new SideslipClassifityAdapter(R.layout.shop_list_brand_search_item, this.twoClassificationModels); ; this.sideslipClassifityAdapter = new SideslipClassifityAdapter(R.layout.shop_list_brand_search_item, this.twoClassificationModelsTwo)) {
            this.sideslipClassifityAdapter.setCheckedClassifity(this.sideSlipCeckedClassifity);
            this.sideslipClassifyContent.setAdapter(this.sideslipClassifityAdapter);
            this.sideslipClassifityAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
                public void onItemClick(BaseQuickAdapter paramAnonymousBaseQuickAdapter, View paramAnonymousView, int paramAnonymousInt) {
                    Log.d("aaaaaaa", "我选择了分类");
                    TextView brand_name = (TextView) paramAnonymousView.findViewById(R.id.brand_name);
                    TextView classifity_id = (TextView) paramAnonymousView.findViewById(R.id.classifity_id);
                    String s = brand_name.getText().toString().trim();
                    int classId = Integer.parseInt(classifity_id.getText().toString().trim());
                    if (SearchGoodsListActivity.this.sideSlipClickClassifity.get("classifityName") != null) {
                        if ((!SearchGoodsListActivity.this.sideSlipClickClassifity.get("classifityName").equals(paramAnonymousBaseQuickAdapter)) && ((Integer) SearchGoodsListActivity.this.sideSlipClickClassifity.get("classifityId") != classId)) {
                            SearchGoodsListActivity.this.sideSlipClickClassifity.put("classifityName", paramAnonymousBaseQuickAdapter);
                            SearchGoodsListActivity.this.sideSlipClickClassifity.put("classifityId", paramAnonymousView);
                        }
                    } else {
                        Log.d("aaaaaaa", "我选择de 分类:" + SearchGoodsListActivity.this.sideSlipClickClassifity.get("classifityName"));
                        SearchGoodsListActivity.this.sideslipClassifityAdapter.setCheckedClassifity(SearchGoodsListActivity.this.sideSlipClickClassifity);
                        SearchGoodsListActivity.this.sideslipClassifityAdapter.notifyDataSetChanged();
                        SearchGoodsListActivity.this.sideSlipClickClassifity.put("classifityName", "");
                        SearchGoodsListActivity.this.sideSlipClickClassifity.put("classifityId", Integer.valueOf(0));
                        SearchGoodsListActivity.this.sideSlipClickClassifity.put("classifityName", paramAnonymousBaseQuickAdapter);
                        SearchGoodsListActivity.this.sideSlipClickClassifity.put("classifityId", paramAnonymousView);
                    }
                }
            });
            return;
        }
    }

    public void setDateToControl() {
        this.goodsListTopSearchText.setText(this.mSearchWorld);
        Drawable localDrawable = getResources().getDrawable(R.drawable.checkmark_m);
        this.onlyLookHasGoodsBtn.setCompoundDrawablesWithIntrinsicBounds(localDrawable, null, null, null);
        this.onlyLookHasGoodsBtn.setCompoundDrawablePadding(-50);
        this.onlyLookHasGoodsBtn.setPadding(20, 0, 0, 0);
        this.onlyLookHasGoodsBtn.setBackgroundResource(R.drawable.goods_check_button_m_checked);
        this.onlyLookHasGoodsBtn.setTextColor(getResources().getColor(R.color.checkGreenColor));
        this.drawerLayout.setScrimColor(getResources().getColor(R.color.transparent_50));
        this.drawerLayout.setDrawerLockMode(1);
        this.main_right_drawer_layout = ((RelativeLayout) findViewById(R.id.main_right_drawer_layout));
        this.synthesizedBtn.setChecked(true);
        this.sideSlipClickBrand = new ArrayList();
        this.sideSlipClickClassifity = new HashMap();
        this.sideSlipCeckedBrand = new ArrayList();
        this.sideSlipCeckedClassifity = new HashMap();
    }

    public void setListener() {
        this.brandSearchOkBtn.setOnClickListener(this);
        this.brandSearchPopuBtn.setOnClickListener(this);
        this.brandSearchResetBtn.setOnClickListener(this);
        this.popupShadow.setOnClickListener(this);
        this.shaixuanBtn.setOnClickListener(this);
        this.onlyLookHasGoodsBtn.setOnClickListener(this);
        this.sideslipOkBtn.setOnClickListener(this);
        this.sideslipResetBtn.setOnClickListener(this);
        this.sideslipClassifyAllBtn.setOnClickListener(this);
        this.sideslipBrandAllBtn.setOnClickListener(this);
        this.goodsListTopSearchText.setOnClickListener(this);
        this.synthesizedBtn.setOnClickListener(this);
        this.saleNumBtn.setOnClickListener(this);
        this.priceBtn.setOnClickListener(this);
        this.ivBackLeft.setOnClickListener(this);
        this.closeBtnImg.setOnClickListener(this);
    }

    public void setPopupWindow() {
        this.checkedtianchuView = LayoutInflater.from(this).inflate(R.layout.shop_list_brand_search_fragment, null);
        this.popupwindow = new PopupWindow(this);
        this.mRecyclerView = ((RecyclerView) this.checkedtianchuView.findViewById(R.id.shop_brand_search));
        this.brandSearchOkBtn = ((TextView) this.checkedtianchuView.findViewById(R.id.brand_search_ok_btn));
        this.brandSearchResetBtn = ((TextView) this.checkedtianchuView.findViewById(R.id.brand_search_reset_btn));
        this.popupShadow = ((TextView) this.checkedtianchuView.findViewById(R.id.popup_shadow));
    }

    public void showOrDismissPopup() {
        this.popupwindow.setBackgroundDrawable(null);
        if (!this.popupwindow.isShowing()) {
            addDataToPopupwindow();
            this.popupwindow.setHeight(this.shopListFragment.getHeight());
            this.popupwindow.setWidth(-1);
            this.popupwindow.setContentView(this.checkedtianchuView);
            this.popupwindow.showAsDropDown(this.goodsSearchRailingBottom);
            this.popupwindow.setFocusable(true);
            this.popupwindow.setOutsideTouchable(true);
            this.brandBtnText.setTextColor(getResources().getColor(R.color.checkGreenColor));
            this.brandBtnUpordownImg.setImageDrawable(getResources().getDrawable(R.drawable.icon_triangle_up));
            return;
        } else {
            popupwindow.dismiss();
        }
    }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/mvp/activity/SearchGoodsListActivity.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */